namespace S.O.Domain.Medical
{
    /// <summary>
    /// 医疗卡办理记录模型
    /// 用于记录医疗卡的办理过程、状态和相关信息
    /// </summary>
    public class MedicalCardModel : BaseEntity
    {
        /// <summary>
        /// 医疗卡号
        /// </summary>
        public string CardNo { get; set; } = string.Empty;
        
        /// <summary>
        /// 患者ID（关联PatientModel）
        /// </summary>
        public long PatientId { get; set; }
        
        /// <summary>
        /// 患者姓名
        /// </summary>
        public string PatientName { get; set; } = string.Empty;
        
        /// <summary>
        /// 身份证号
        /// </summary>
        public string IdCard { get; set; } = string.Empty;
        
        /// <summary>
        /// 联系电话
        /// </summary>
        public string Phone { get; set; } = string.Empty;
        
        /// <summary>
        /// 办卡类型（新办、补办、换卡等）
        /// </summary>
        public string CardType { get; set; } = "新办";
        
        /// <summary>
        /// 办卡费用
        /// </summary>
        public decimal CardFee { get; set; } = 10.00m;
        
        /// <summary>
        /// 办卡状态（申请中、已办理、已激活、已挂失、已注销）
        /// </summary>
        public string CardStatus { get; set; } = "已办理";
        
        /// <summary>
        /// 办卡日期
        /// </summary>
        public DateTime IssueDate { get; set; } = DateTime.Now;
        
        /// <summary>
        /// 激活日期
        /// </summary>
        public DateTime? ActivateDate { get; set; }
        
        /// <summary>
        /// 有效期（默认5年）
        /// </summary>
        public DateTime ExpiryDate { get; set; } = DateTime.Now.AddYears(5);
        
        /// <summary>
        /// 办卡操作员
        /// </summary>
        public string Operator { get; set; } = string.Empty;
        
        /// <summary>
        /// 办卡窗口/科室
        /// </summary>
        public string IssueLocation { get; set; } = string.Empty;
        
        /// <summary>
        /// 备注信息
        /// </summary>
        public string Remarks { get; set; } = string.Empty;
        
        /// <summary>
        /// 是否首次办卡
        /// </summary>
        public bool IsFirstTime { get; set; } = true;
        
        /// <summary>
        /// 原卡号（补办或换卡时使用）
        /// </summary>
        public string? OriginalCardNo { get; set; }
        
        /// <summary>
        /// 是否启用
        /// </summary>
        public bool IsEnable { get; set; } = true;
        
        /// <summary>
        /// 卡片是否有效（未过期且未挂失）
        /// </summary>
        public bool IsValid => IsEnable && 
                              CardStatus != "已挂失" && 
                              CardStatus != "已注销" && 
                              ExpiryDate > DateTime.Now;
    }
}